package day1104.demo02;

import java.util.function.Supplier;

/**
 * @author wql
 * @version 1.0
 * @date 2022/11/4 9:53
 */

public class Test {
    public static void main(String[] args) {

        //首先创建对象
        Student student = new Student("老王",16);
        //观察该lambda表达式: 对象名.实例方法（）。
       // Supplier<String> supplier =()-> student.getName();

        //引用方法
        Supplier<String> supplier =student::getName;

        System.out.println(supplier.get());
    }

}
class Student{
    private String name;
    private Integer age;

    public Student(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
